#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{

  pid_t id = fork();
  if(id == 0)
  {
    extern char** environ;
    sleep(1);
    execle("./mytest","mytest",NULL,environ);
    //exercl("./mytest","mytest",NULL);
    //char* const argv[]={(char*)"ls",
    //                    (char*)"-a",
    //                    (char*)"-l",
    //                    NULL};
    //sleep(1);
    //printf("exec begin...");
    //execl("/usr/bin/ls","ls","-a","-l",NULL);
    // execlp("ls","ls","-a","-l",NULL);
    //execv("/usr/bin/nl-link-enslave",argv);
    //execvp("ls",argv);
    //execl("./mytest","mytest",NULL);
    printf("exec end....\n");
    exit(1);
  }

  pid_t rid = waitpid(id,NULL,0);
  if(rid > 0)
  {
    printf("wait success\n");
  }
  return 0;
}
